/**
 * @param {number[]} cards
 * @return {number}
 */
 var minimumCardPickup = function(cards) {
  const mp = new Map()
  let ans = Infinity
  for(let i = 0; i<cards.length; i++) {
    if(mp.has(cards[i])) {
      ans = Math.min(ans, i - mp.get(cards[i]) + 1)
    }
    mp.set(cards[i], i)
  }
  return ans === Infinity ? -1 : ans
};